package com.zengqingfa.shardingjdbc.demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

/**
 *
 * @fileName: DictDao
 * @author: zengqf3
 * @date: 2021-3-28 10:52
 * @description:
 */
public interface DictDao extends BaseMapper {

    /**
     *  新增字典
     * @param dictId
     * @param type  字典类型
     * @param code  字典编码
     * @param value 字典值
     * @return
     */
    @Insert("insert into t_dict(dict_id,type,code,value) value(#{dictId},#{type},#{code},#{value})")
    int insertDict( @Param("dictId") Long dictId,
                    @Param("type") String type,
                    @Param("code") String code,
                    @Param("value") String value);


    /**
     * 删除字典
     * @param dictId    字典id
     * @return
     */
    @Delete("delete from t_dict where dict_id = #{dictId}")
    int deleteDict(@Param("dictId") Long dictId);
}
